package node.exp;

import grammar.Lexer;
import node.Node;
import symbol.SymbolTable;

public class ConstExp implements Node {
    private final Lexer lexer;
    private final SymbolTable table;
    private final Node father;
    public AddExp addExp;

    public ConstExp(Lexer lexer, SymbolTable table, Node father) {
        this.lexer = lexer;
        this.table = table;
        this.father = father;
        parseConstExp();
    }

    private void parseConstExp() {
        addExp = new AddExp(lexer, table, this);
    }

    public int getValue() {
        return addExp.getValue();
    }

    @Override
    public Node getFather() {
        return father;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(addExp.toString());
        return sb.append("<ConstExp>\n").toString();
    }

    @Override
    public String genMidCode() {
        return null;
    }

}
